

TOOLPATH = ../z_tools/
INCPATH  = ../z_tools/haribote/

MAKE     = $(TOOLPATH)make.exe -r
NASK     = $(TOOLPATH)nask.exe
EDIMG    = $(TOOLPATH)edimg.exe
IMGTOL   = $(TOOLPATH)imgtol.com

COPY     = copy
DEL      = del


os.img: arch/ipl20.bin arch/os.sys Makefile \
	a/a.hrb vi/vi.hrb 
	$(EDIMG)   imgin:..\z_tools\fdimg0at.tek \
		wbinimg src:arch/ipl20.bin len:512 from:0 to:0 \
		copy from:arch/os.sys to:@: \
		copy from:files/night_.bmp to:@: \
		copy from:files/bg.jpg to:@: \
		copy from:a/a.hrb to:@: \
		copy from:vi/vi.hrb to:@: \
		copy from:arch/ipl20.nas to:@: \
		copy from:make.bat to:@: \
		copy from:app_make.txt to:@: \
		imgout:os.img

# 先编译生成子模块，再生成os.img
full:
	$(MAKE) -C include  
	$(MAKE) -C arch  
	$(MAKE) -C a
	$(MAKE) -C vi
#	$(MAKE) -C hello
#	$(MAKE) -C test
	$(MAKE) os.img

run:
	$(MAKE) full
	$(COPY) os.img ..\z_tools\qemu\fdimage0.bin
	$(MAKE) -C ../z_tools/qemu

install:
	$(MAKE) img
	..\z_tools\imgtol.com w a: os.img


cl:
	-$(DEL) os.img
	$(MAKE) -C include  cl  
	$(MAKE) -C arch     cl
	$(MAKE) -C a     cl
	$(MAKE) -C vi     cl

cla:
	$(MAKE) -C a     cl
	$(MAKE) -C vi     cl